home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / UPC12BS1.ZIP / LIB / LIB.H < prev    next >
C/C++ Source or Header  |  1993-09-29  |  12KB  |  314 lines

  1. /*--------------------------------------------------------------------*/
  2. /*       l i b . h                                                    */
  3. /*--------------------------------------------------------------------*/
  4.  
  5. /*--------------------------------------------------------------------*/
  6. /*       Changes Copyright (c) 1989-1993 by Kendra Electronic         */
  7. /*       Wonderworks.                                                 */
  8. /*                                                                    */
  9. /*       All rights reserved except those explicitly granted by       */
  10. /*       the UUPC/extended license agreement.                         */
  11. /*--------------------------------------------------------------------*/
  12.  
  13. /*--------------------------------------------------------------------*/
  14. /*                          RCS Information                           */
  15. /*--------------------------------------------------------------------*/
  16.  
  17. /*
  18.  *    $Id: lib.h 1.13 1993/09/29 04:56:11 ahd Exp $
  19.  *
  20.  *    Revision history:
  21.  *    $Log: lib.h $
  22.  *     Revision 1.13  1993/09/29  04:56:11  ahd
  23.  *     Revise B_KEWSHORT to B_SHORT
  24.  *
  25.  *     Revision 1.12  1993/09/20  04:51:31  ahd
  26.  *     1.12OS/2 2.x support
  27.  *
  28.  *     Revision 1.11  1993/08/08  17:39:55  ahd
  29.  *     Define denormalize() macro
  30.  *
  31.  *     Revision 1.10  1993/07/22  23:26:19  ahd
  32.  *     First pass of changes for Robert Denny's Windows 3.1 support
  33.  *
  34.  *     Revision 1.9  1993/07/19  02:53:32  ahd
  35.  *     Update copyright year'
  36.  *
  37.  *     Revision 1.8  1993/06/13  14:12:29  ahd
  38.  *     Changes per Mike McLagan for outbound batched news support
  39.  *
  40.  *     Revision 1.7  1993/05/30  15:27:22  ahd
  41.  *     Drop PASSWD, SYSTEMS definitions
  42.  *
  43.  *     Revision 1.6  1993/05/30  00:11:03  ahd
  44.  *     Drop free() macro
  45.  *     Drop hardcoded PASSWD and SYSTEM file names
  46.  *     Add RCSID macro
  47.  *
  48.  *     Revision 1.5  1993/04/04  21:51:00  ahd
  49.  *     Update copyright
  50.  *
  51.  *     Revision 1.4  1993/03/06  23:09:50  ahd
  52.  *     Break variable names out of master lib.h
  53.  *
  54.  *     Revision 1.3  1992/12/01  04:39:34  ahd
  55.  *     Add SpeedOverMemory
  56.  *
  57.  * Revision 1.2  1992/11/22  21:31:22  ahd
  58.  * Allow strpool() to allocate memory for const strings
  59.  *
  60.  * Revision 1.1  1992/11/16  05:00:26  ahd
  61.  * Initial revision
  62.  *
  63.  */
  64.  
  65. #ifndef __LIB
  66. #define __LIB
  67.  
  68. #if defined(WIN32) || defined(__OS2__)
  69. #define BIT32ENV
  70. #endif
  71.  
  72. #include <confvars.h>
  73.  
  74. /*--------------------------------------------------------------------*/
  75. /*     Environment variables set by UUXQT before invoking modules     */
  76. /*--------------------------------------------------------------------*/
  77.  
  78. #define UU_USER "UU_USER"
  79. #define UU_MACHINE "UU_MACHINE"
  80. #define LOGNAME "LOGNAME"
  81. #define RMAIL   "rmail"
  82. #define RNEWS   "rnews"
  83.  
  84. /*--------------------------------------------------------------------*/
  85. /*                   Global configuration variables                   */
  86. /*--------------------------------------------------------------------*/
  87.  
  88. #define SYSRCSYM "UUPCSYSRC"
  89. #define USRRCSYM  "UUPCUSRRC"
  90. #define SYSDEBUG  "UUPCDEBUG"    /* Initialize debug level ahd       */
  91.  
  92. /*--------------------------------------------------------------------*/
  93. /*                 Macro for recording when UUPC dies                 */
  94. /*--------------------------------------------------------------------*/
  95.  
  96. #define panic()  bugout( __LINE__, cfnptr)
  97.  
  98. /*--------------------------------------------------------------------*/
  99. /*                 Macro for generic error messages from DOS          */
  100. /*--------------------------------------------------------------------*/
  101.  
  102. #define printerr( x )  prterror( __LINE__, cfnptr, x)
  103.  
  104. /*--------------------------------------------------------------------*/
  105. /*                  Convert hours/minutes to seconds                  */
  106. /*--------------------------------------------------------------------*/
  107.  
  108. #define hhmm2sec(HHMM)    ((time_t)(((HHMM / 100) * 60L) + \
  109.                            (time_t)(HHMM % 100)) * 60L)
  110.  
  111. #define RCSID static const char UUFAR rcsid[] =
  112.  
  113. /*--------------------------------------------------------------------*/
  114. /*                     Configuration file defines                     */
  115. /*--------------------------------------------------------------------*/
  116.  
  117. #define B_REQUIRED 0x00000001L /* Line must appear in configuration   */
  118. #define B_FOUND    0x00000002L /* We found the token                  */
  119.  
  120. #define B_GLOBAL   0x00000004L /* Must not appear in PERSONAL.RC      */
  121. #define B_LOCAL    0x00000008L /* The opposite of B_GLOBAL, sort of   */
  122.  
  123. #define B_MTA      0x00000010L /* Used by Mail Delivery (RMAIL)       */
  124. #define B_MUA      0x00000020L /* Used by Mail User Agent (MAIL)      */
  125. #define B_MUSH     0x00000040L /* Used by MUSH - Not used by UUPC     */
  126. #define B_NEWS     0x00000080L /* Used by NEWS software               */
  127. #define B_UUCICO   0x00000100L /* Used by transport program UUCICO    */
  128. #define B_UUCP     0x00000200L /* Used by UUCP command                */
  129. #define B_UUPOLL   0x00000400L /* UUPOLL program                      */
  130. #define B_UUSTAT   0x00000800L /* UUSTAT, UUSUB, UUNAME programs      */
  131. #define B_UUXQT    0x00001000L /* Used by queue processor UUXQT       */
  132. #define B_INSTALL  0x00002000L /* Used by install program only        */
  133. #define B_BATCH    0x00004000L // Used by news batching program - GMM
  134. #define B_MAIL     (B_MUA | B_MTA | B_MUSH)
  135. #define B_SPOOL    (B_MTA | B_NEWS | B_UUCICO | B_UUXQT | B_UUCP | B_UUSTAT)
  136. #define B_ALL      (B_MAIL|B_SPOOL|B_NEWS|B_UUPOLL|B_UUSTAT|B_BATCH)
  137.  
  138. #define B_SHORT    0x00010000L /* Pointer is to short int, not string */
  139. #define B_TOKEN    0x00020000L /* Pointer is one word, ignore blanks  */
  140. #define B_BOOLEAN  0x00040000L /* Pointer is to boolean keywords      */
  141. #define B_LIST     0x00080000L /* Pointer to array of char pointers   */
  142. #define B_CLIST    0x00100000L /* Pointer to array of char pointers,
  143.                                   input is separated by colons, not
  144.                                   spaces                              */
  145. #define B_STRING   0x00200000L /* String value (same as original UUPC
  146.                                   configuration processor             */
  147. #define B_NORMAL   0x00400000L /* Normalize backslashes to slashes in
  148.                                   in this variable                    */
  149. #define B_OBSOLETE 0x00800000L /* Option is obsolete, should be
  150.                                   deleted                             */
  151. #define B_MALLOC   0x01000000L  /* Use malloc(), not newstr()         */
  152. #define B_LONG     0x02000000L  /* Pointer is to long, not string     */
  153. #define B_PATH     (B_TOKEN | B_NORMAL)
  154.                                /* DOS Path name                       */
  155.  
  156. /*--------------------------------------------------------------------*/
  157. /*                     General defines and macros                     */
  158. /*--------------------------------------------------------------------*/
  159.  
  160. #define  MESSAGESEP "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\n"
  161.  
  162. #define DCSTATUS    "hostatus"
  163. #define PATHS       "hostpath"
  164. #define PERMISSIONS "permissn"
  165. #define SYSLOG      "syslog"
  166. #define ACTIVE      "active"
  167.  
  168. #define WHITESPACE " \t\n\r"
  169.  
  170. /*--------------------------------------------------------------------*/
  171. /*    Equality macros                                                 */
  172. /*--------------------------------------------------------------------*/
  173.  
  174. #define equal(a,b)               (!strcmp(a,b))
  175. #define equali(a,b)              (!stricmp(a,b))                     /*ahd */
  176. #define equalni(a,b,n)           (!strnicmp(a,b,n))                  /*ahd */
  177. #define equaln(a,b,n)            (!strncmp(a,b,n))
  178.  
  179. #ifndef __FILE__
  180. #error __FILE__ must be defined!!!
  181. #endif
  182.  
  183. #define currentfile()            static char *cfnptr = __FILE__
  184. #define checkref(a)              (checkptr(a, cfnptr ,__LINE__))     /*ahd */
  185. #define newstr(a)                (strpool(a, cfnptr ,__LINE__))
  186. #ifdef SAFEFREE
  187. #define free(a)                  (safefree(a, cfnptr ,__LINE__